<template>
	<view>
		<view class="avatar">
			<image :src="doctor_info.avatar"></image>
			<text>{{doctor_info.introduce}}</text>	
		</view>
		<view class="scheme">
			<view class="scheme-item" v-for="(item,i) in doctor_scheme" @click="submit(item)">
				<view class="time">{{item.time}}</view>
				<view class="status">{{item.status}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import{mapState,mapMutations} from 'vuex'
	export default {
		data() {
			return {
				doctor_info:{
					avatar:"/static/image/LYQ.jpg",
					introduce:"有多年外科临床经验",
					name:"赖金明",
					depart:"神经外科"
				},
				doctor_scheme:[
					{
						time:"星期一上午9:00-11:30",
						status:"有号"
					},
					{
						time:"星期一下午2:30-5:00",
						status:"无号"
					},
					{
						time:"星期二上午9:00-11:30",
						status:"有号"
					},
					{
						time:"星期三下午2:30-5:00",
						status:"无号"
					}
				]
				
			}
			
			
		},
		methods:{
			...mapMutations("m_doctor",["updateOrder"]),
			submit(item){
				let doctor={};
				doctor.name=this.doctor_info.name;
				doctor.depart=this.doctor_info.depart;
				doctor.time= new Date();
				doctor.orderTime = item.time;
				console.log(doctor);
				this.updateOrder(doctor);
				console.log("提交成功");
				if(uni.getStorageSync("order"))
				{uni.$showMsg("预约成功!!!")}
				setTimeout(()=>{
					uni.switchTab({
					url:"/pages/my/my"
				})
				},1500)
			}
		}
	}
</script>

<style lang="less">
	.avatar{
		display: flex;
		padding: 30rpx 0;
		margin: 30px 20rpx 0 20rpx;
		border: 1px solid #000000;
		justify-content: space-around;
		image{
			width: 40%;
			height: 400rpx;
		}
		text{
			height: 400rpx;
		}
	}
	.scheme{
		margin: 30px 20rpx 0 20rpx;
		.scheme-item{
		display: flex;
		justify-content: space-around;
		align-items: center;
		margin-bottom: 20px;
		border: 1px solid #454545;
		height: 40px;
		.time{
			font-size: 15px;
			width: 60%;
		}
	}
	}

</style>
